package com.lyx.userserver.user.controller;

import com.lyx.common.vo.R;
import com.lyx.userserver.user.param.LoginParam;
import com.lyx.userserver.user.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/app/user")
public class LoginController {

    @Resource
    private UserService userService;

    /**
     * 登录
     *
     * @param loginParam
     * @return
     */
    @PostMapping("/login")
    public R<String> login(@RequestBody LoginParam loginParam) {
        String jwt = userService.login(loginParam);
        return R.ok(jwt);
    }

}
